<script src="jquery-1.7.2.min.js"></script>
<?php
 $_GET = $_POST;

 $email   = $_GET['email'];
 $nome  = $_GET['nome'];
 $sobre_nome= $_GET['sobre_nome'];
 //  autentica
$client = new SoapClient(null, array(
	'location' => 'http://ligadonoenem.com/loja/path/servidor/server.php',  //'http://ligadonoenem.com/loja/path/servidor/server.php', //
	'uri'      => 'http://ligadonoenem.com/loja/path/servidor/',             // 'http://ligadonoenem.com/loja/path/servidor/',  		//
	'trace'    => 1));
$has_email = explode('@',$email);
$result     = $client->User("$email","$has_email[0]",'1aa123',$nome,$sobre_nome); 

if(!is_array($result)){
   echo "
    <style>
      #insert{
       width: 200px;
       height: 40px;
       border: 1px #ccc solid;
       background-color: #ccc;
      }
    </style>
     User!
    <div id='insert'>
         Inserindo user!
    </div>
        <script>
            $('#insert').load('../authentication_new.php',{'email':'$email','nome':'$nome','sobre_nome':'$sobre_nome'});
        </script>";
    

    $result['email'] = $email;
    $result['senha'] = $passwd;
}


if (is_soap_fault($result)){
	trigger_error("SOAP Fault: (faultcode: {$result->faultcode},
	faultstring: {$result->faulstring})", E_ERROR);
}else{
   $email = $result['email']; 
   $passwd = $result['senha']; 

   echo "
    <style>
      #livrex{
       width: 200px;
       height: 40px;
       border: 1px #ccc solid;
       background-color: #ccc;
      }    
    </style>
      Logando!
    <div id='livrex'>
         Não logado!
    </div>
        <script>
            $('#livrex').load('../authentication_ext.php',{'SubmitLogin':'', 'email':'$email','passwd':'$passwd'});
        </script>";
}
?>

